package com.example.springboothello.springDeal;

import com.example.springboothello.enums.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SpringClient {

    private ParserFactory parserFactory;

    @Autowired
    public SpringClient(ParserFactory parserFactory) {
        this.parserFactory = parserFactory;
    }
    public void getAll(String contentType) {
        // 关键点，直接根据类型获取
         parserFactory
                .getParser(contentType)
                .parse("1");
    }
}
